cmake_minimum_required (VERSION 3.0)

project (Chapter5)

file(GLOB src_files *.cpp)

find_package(OpenCV REQUIRED)

foreach(src_file ${src_files})
    get_filename_component(src_file_base ${src_file} NAME_WE)
    # message(${src_file_base})
    file(RELATIVE_PATH src_file_rel ${CMAKE_CURRENT_LIST_DIR} ${src_file})
    # message(${src_file_rel})
    add_executable(${src_file_base} ${src_file_rel})
    target_include_directories(${src_file_base} PRIVATE ${OpenCV_INCLUDE_DIRS})
    target_link_directories(${src_file_base} PRIVATE ${OpenCV_LIB_DIRS})
    target_link_libraries(${src_file_base} ${OpenCV_LIBS})
endforeach()
